package com.ahrhyj.web.controller.system;

import com.ahrhyj.common.core.controller.BaseController;
import com.ahrhyj.common.utils.DownloadUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.InputStream;


@Api(tags = "项目主类控制类")
@RestController
@RequestMapping("/index")
public class IndexController extends BaseController {


    @Value("${template.dirPath}")
    private String dirPath;


    /**
     * 下载操作手册
     */
    @ApiOperation("下载操作手册")
    @PostMapping("/downloadCzscBusiness")
    public void downloadCzscBusiness() {
        InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(dirPath + "政企互通服务平台操作手册_企业版.docx");
        DownloadUtil.downloadInputStream(inputStream, "政企互通服务平台操作手册_企业版.docx");
    }

    /**
     * 下载操作手册
     */
    @ApiOperation("下载操作手册")
    @PostMapping("/downloadCzscGov")
    public void downloadCzscGov() {
        InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(dirPath + "政企互通服务平台操作手册_政府版.docx");
        DownloadUtil.downloadInputStream(inputStream, "政企互通服务平台操作手册_政府版.docx");
    }

}
